home *** CD-ROM | disk | FTP | other *** search
/ Oh!X 2000 Spring / Oh!X 2000 Spring Special CD-ROM (Japan) (Part 2).7z / Oh!X 2000 Spring Special CD-ROM (Japan) (Part 2).bin / DXF / include / d3dtypes.h < prev    next >
C/C++ Source or Header  |  1999-09-08  |  67KB  |  1,817 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1995-1998 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:   d3dtypes.h
  6.  *  Content:    Direct3D types include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef _D3DTYPES_H_
  11. #define _D3DTYPES_H_
  12.  
  13. #include <windows.h>
  14.  
  15. #include <float.h>
  16. #include "ddraw.h"
  17.  
  18. #ifndef DIRECT3D_VERSION
  19. #define DIRECT3D_VERSION         0x0700
  20. #endif
  21.  
  22. #pragma warning(disable:4201) // anonymous unions warning
  23. #pragma pack(4)
  24.  
  25.  
  26. /* D3DVALUE is the fundamental Direct3D fractional data type */
  27.  
  28. #define D3DVALP(val, prec) ((float)(val))
  29. #define D3DVAL(val) ((float)(val))
  30. typedef float D3DVALUE, *LPD3DVALUE;
  31. #define D3DDivide(a, b)    (float)((double) (a) / (double) (b))
  32. #define D3DMultiply(a, b)    ((a) * (b))
  33.  
  34. typedef LONG D3DFIXED;
  35.  
  36. #ifndef RGB_MAKE
  37. /*
  38.  * Format of CI colors is
  39.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  40.  *  |    alpha      |         color index           |   fraction    |
  41.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  42.  */
  43. #define CI_GETALPHA(ci)    ((ci) >> 24)
  44. #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  45. #define CI_GETFRACTION(ci) ((ci) & 0xff)
  46. #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  47. #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  48. #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  49.  
  50. /*
  51.  * Format of RGBA colors is
  52.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  53.  *  |    alpha      |      red      |     green     |     blue      |
  54.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  55.  */
  56. #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  57. #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  58. #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  59. #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  60. #define RGBA_MAKE(r, g, b, a)   ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  61.  
  62. /* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  63.  * The float values must be in the range 0..1
  64.  */
  65. #define D3DRGB(r, g, b) \
  66.     (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  67. #define D3DRGBA(r, g, b, a) \
  68.     (   (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  69.     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  70.     )
  71.  
  72. /*
  73.  * Format of RGB colors is
  74.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  75.  *  |    ignored    |      red      |     green     |     blue      |
  76.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  77.  */
  78. #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  79. #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  80. #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  81. #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  82. #define RGB_MAKE(r, g, b)       ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b)))
  83. #define RGBA_TORGB(rgba)       ((D3DCOLOR) ((rgba) & 0xffffff))
  84. #define RGB_TORGBA(rgb)        ((D3DCOLOR) ((rgb) | 0xff000000))
  85.  
  86. #endif
  87.  
  88. /*
  89.  * Flags for Enumerate functions
  90.  */
  91.  
  92. /*
  93.  * Stop the enumeration
  94.  */
  95. #define D3DENUMRET_CANCEL                        DDENUMRET_CANCEL
  96.  
  97. /*
  98.  * Continue the enumeration
  99.  */
  100. #define D3DENUMRET_OK                            DDENUMRET_OK
  101.  
  102. typedef HRESULT (CALLBACK* LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset);
  103. typedef HRESULT (CALLBACK* LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext);
  104. typedef HRESULT (CALLBACK* LPD3DENUMPIXELFORMATSCALLBACK)(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext);
  105.  
  106. typedef DWORD D3DCOLOR, *LPD3DCOLOR;
  107.  
  108. typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE;
  109. typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE;
  110. typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE;
  111.  
  112. typedef struct _D3DCOLORVALUE {
  113.     union {
  114.     D3DVALUE r;
  115.     D3DVALUE dvR;
  116.     };
  117.     union {
  118.     D3DVALUE g;
  119.     D3DVALUE dvG;
  120.     };
  121.     union {
  122.     D3DVALUE b;
  123.     D3DVALUE dvB;
  124.     };
  125.     union {
  126.     D3DVALUE a;
  127.     D3DVALUE dvA;
  128.     };
  129. } D3DCOLORVALUE, *LPD3DCOLORVALUE;
  130.  
  131. typedef struct _D3DRECT {
  132.     union {
  133.     LONG x1;
  134.     LONG lX1;
  135.     };
  136.     union {
  137.     LONG y1;
  138.     LONG lY1;
  139.     };
  140.     union {
  141.     LONG x2;
  142.     LONG lX2;
  143.     };
  144.     union {
  145.     LONG y2;
  146.     LONG lY2;
  147.     };
  148. } D3DRECT, *LPD3DRECT;
  149.  
  150. typedef struct _D3DVECTOR {
  151.     union {
  152.     D3DVALUE x;
  153.     D3DVALUE dvX;
  154.     };
  155.     union {
  156.     D3DVALUE y;
  157.     D3DVALUE dvY;
  158.     };
  159.     union {
  160.     D3DVALUE z;
  161.     D3DVALUE dvZ;
  162.     };
  163. #if(DIRECT3D_VERSION >= 0x0500)
  164. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  165.  
  166. public:
  167.  
  168.     // =====================================
  169.     // Constructors
  170.     // =====================================
  171.  
  172.     _D3DVECTOR() { }
  173.     _D3DVECTOR(D3DVALUE f);
  174.     _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z);
  175.     _D3DVECTOR(const D3DVALUE f[3]);
  176.  
  177.     // =====================================
  178.     // Access grants
  179.     // =====================================
  180.  
  181.     const D3DVALUE&operator[](int i) const;
  182.     D3DVALUE&operator[](int i);
  183.  
  184.     // =====================================
  185.     // Assignment operators
  186.     // =====================================
  187.  
  188.     _D3DVECTOR& operator += (const _D3DVECTOR& v);
  189.     _D3DVECTOR& operator -= (const _D3DVECTOR& v);
  190.     _D3DVECTOR& operator *= (const _D3DVECTOR& v);
  191.     _D3DVECTOR& operator /= (const _D3DVECTOR& v);
  192.     _D3DVECTOR& operator *= (D3DVALUE s);
  193.     _D3DVECTOR& operator /= (D3DVALUE s);
  194.  
  195.     // =====================================
  196.     // Unary operators
  197.     // =====================================
  198.  
  199.     friend _D3DVECTOR operator + (const _D3DVECTOR& v);
  200.     friend _D3DVECTOR operator - (const _D3DVECTOR& v);
  201.  
  202.  
  203.     // =====================================
  204.     // Binary operators
  205.     // =====================================
  206.  
  207.     // Addition and subtraction
  208.         friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  209.         friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  210.     // Scalar multiplication and division
  211.         friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s);
  212.         friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v);
  213.         friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s);
  214.     // Memberwise multiplication and division
  215.         friend _D3DVECTOR operator * (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  216.         friend _D3DVECTOR operator / (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  217.  
  218.     // Vector dominance
  219.         friend int operator < (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  220.         friend int operator <= (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  221.  
  222.     // Bitwise equality
  223.         friend int operator == (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  224.  
  225.     // Length-related functions
  226.         friend D3DVALUE SquareMagnitude (const _D3DVECTOR& v);
  227.         friend D3DVALUE Magnitude (const _D3DVECTOR& v);
  228.  
  229.     // Returns vector with same direction and unit length
  230.         friend _D3DVECTOR Normalize (const _D3DVECTOR& v);
  231.  
  232.     // Return min/max component of the input vector
  233.         friend D3DVALUE Min (const _D3DVECTOR& v);
  234.         friend D3DVALUE Max (const _D3DVECTOR& v);
  235.  
  236.     // Return memberwise min/max of input vectors
  237.         friend _D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  238.         friend _D3DVECTOR Maximize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  239.  
  240.     // Dot and cross product
  241.         friend D3DVALUE DotProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  242.         friend _D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
  243.  
  244. #endif
  245. #endif /* DIRECT3D_VERSION >= 0x0500 */
  246. } D3DVECTOR, *LPD3DVECTOR;
  247.  
  248. /*
  249.  * Vertex data types supported in an ExecuteBuffer.
  250.  */
  251.  
  252. /*
  253.  * Homogeneous vertices
  254.  */
  255.  
  256. typedef struct _D3DHVERTEX {
  257.     DWORD           dwFlags;        /* Homogeneous clipping flags */
  258.     union {
  259.     D3DVALUE    hx;
  260.     D3DVALUE    dvHX;
  261.     };
  262.     union {
  263.     D3DVALUE    hy;
  264.     D3DVALUE    dvHY;
  265.     };
  266.     union {
  267.     D3DVALUE    hz;
  268.     D3DVALUE    dvHZ;
  269.     };
  270. } D3DHVERTEX, *LPD3DHVERTEX;
  271.  
  272. /*
  273.  * Transformed/lit vertices
  274.  */
  275. typedef struct _D3DTLVERTEX {
  276.     union {
  277.     D3DVALUE    sx;             /* Screen coordinates */
  278.     D3DVALUE    dvSX;
  279.     };
  280.     union {
  281.     D3DVALUE    sy;
  282.     D3DVALUE    dvSY;
  283.     };
  284.     union {
  285.     D3DVALUE    sz;
  286.     D3DVALUE    dvSZ;
  287.     };
  288.     union {
  289.     D3DVALUE    rhw;        /* Reciprocal of homogeneous w */
  290.     D3DVALUE    dvRHW;
  291.     };
  292.     union {
  293.     D3DCOLOR    color;          /* Vertex color */
  294.     D3DCOLOR    dcColor;
  295.     };
  296.     union {
  297.     D3DCOLOR    specular;       /* Specular component of vertex */
  298.     D3DCOLOR    dcSpecular;
  299.     };
  300.     union {
  301.     D3DVALUE    tu;             /* Texture coordinates */
  302.     D3DVALUE    dvTU;
  303.     };
  304.     union {
  305.     D3DVALUE    tv;
  306.     D3DVALUE    dvTV;
  307.     };
  308. #if(DIRECT3D_VERSION >= 0x0500)
  309. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  310.     _D3DTLVERTEX() { }
  311.     _D3DTLVERTEX(const D3DVECTOR& v, float _rhw,
  312.                  D3DCOLOR _color, D3DCOLOR _specular,
  313.                  float _tu, float _tv)
  314.         { sx = v.x; sy = v.y; sz = v.z; rhw = _rhw;
  315.           color = _color; specular = _specular;
  316.           tu = _tu; tv = _tv;
  317.         }
  318. #endif
  319. #endif /* DIRECT3D_VERSION >= 0x0500 */
  320. } D3DTLVERTEX, *LPD3DTLVERTEX;
  321.  
  322. /*
  323.  * Untransformed/lit vertices
  324.  */
  325. typedef struct _D3DLVERTEX {
  326.     union {
  327.     D3DVALUE     x;             /* Homogeneous coordinates */
  328.     D3DVALUE     dvX;
  329.     };
  330.     union {
  331.     D3DVALUE     y;
  332.     D3DVALUE     dvY;
  333.     };
  334.     union {
  335.     D3DVALUE     z;
  336.     D3DVALUE     dvZ;
  337.     };
  338.     DWORD            dwReserved;
  339.     union {
  340.     D3DCOLOR     color;         /* Vertex color */
  341.     D3DCOLOR     dcColor;
  342.     };
  343.     union {
  344.     D3DCOLOR     specular;      /* Specular component of vertex */
  345.     D3DCOLOR     dcSpecular;
  346.     };
  347.     union {
  348.     D3DVALUE     tu;            /* Texture coordinates */
  349.     D3DVALUE     dvTU;
  350.     };
  351.     union {
  352.     D3DVALUE     tv;
  353.     D3DVALUE     dvTV;
  354.     };
  355. #if(DIRECT3D_VERSION >= 0x0500)
  356. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  357.     _D3DLVERTEX() { }
  358.     _D3DLVERTEX(const D3DVECTOR& v,
  359.                 D3DCOLOR _color, D3DCOLOR _specular,
  360.                 float _tu, float _tv)
  361.         { x = v.x; y = v.y; z = v.z; dwReserved = 0;
  362.           color = _color; specular = _specular;
  363.           tu = _tu; tv = _tv;
  364.         }
  365. #endif
  366. #endif /* DIRECT3D_VERSION >= 0x0500 */
  367. } D3DLVERTEX, *LPD3DLVERTEX;
  368.  
  369. /*
  370.  * Untransformed/unlit vertices
  371.  */
  372.  
  373. typedef struct _D3DVERTEX {
  374.     union {
  375.     D3DVALUE     x;             /* Homogeneous coordinates */
  376.     D3DVALUE     dvX;
  377.     };
  378.     union {
  379.     D3DVALUE     y;
  380.     D3DVALUE     dvY;
  381.     };
  382.     union {
  383.     D3DVALUE     z;
  384.     D3DVALUE     dvZ;
  385.     };
  386.     union {
  387.     D3DVALUE     nx;            /* Normal */
  388.     D3DVALUE     dvNX;
  389.     };
  390.     union {
  391.     D3DVALUE     ny;
  392.     D3DVALUE     dvNY;
  393.     };
  394.     union {
  395.     D3DVALUE     nz;
  396.     D3DVALUE     dvNZ;
  397.     };
  398.     union {
  399.     D3DVALUE     tu;            /* Texture coordinates */
  400.     D3DVALUE     dvTU;
  401.     };
  402.     union {
  403.     D3DVALUE     tv;
  404.     D3DVALUE     dvTV;
  405.     };
  406. #if(DIRECT3D_VERSION >= 0x0500)
  407. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  408.     _D3DVERTEX() { }
  409.     _D3DVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, float _tu, float _tv)
  410.         { x = v.x; y = v.y; z = v.z;
  411.           nx = n.x; ny = n.y; nz = n.z;
  412.           tu = _tu; tv = _tv;
  413.         }
  414. #endif
  415. #endif /* DIRECT3D_VERSION >= 0x0500 */
  416. } D3DVERTEX, *LPD3DVERTEX;
  417.  
  418.  
  419. /*
  420.  * Matrix, viewport, and tranformation structures and definitions.
  421.  */
  422.  
  423. typedef struct _D3DMATRIX {
  424. #if(DIRECT3D_VERSION >= 0x0500)
  425. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  426.     union {
  427.         struct {
  428. #endif
  429.  
  430. #endif /* DIRECT3D_VERSION >= 0x0500 */
  431.             D3DVALUE        _11, _12, _13, _14;
  432.             D3DVALUE        _21, _22, _23, _24;
  433.             D3DVALUE        _31, _32, _33, _34;
  434.             D3DVALUE        _41, _42, _43, _44;
  435.  
  436. #if(DIRECT3D_VERSION >= 0x0500)
  437. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  438.         };
  439.         D3DVALUE m[4][4];
  440.     };
  441.     _D3DMATRIX() { }
  442.     _D3DMATRIX( D3DVALUE _m00, D3DVALUE _m01, D3DVALUE _m02, D3DVALUE _m03,
  443.                 D3DVALUE _m10, D3DVALUE _m11, D3DVALUE _m12, D3DVALUE _m13,
  444.                 D3DVALUE _m20, D3DVALUE _m21, D3DVALUE _m22, D3DVALUE _m23,
  445.                 D3DVALUE _m30, D3DVALUE _m31, D3DVALUE _m32, D3DVALUE _m33
  446.         )
  447.         {
  448.                 m[0][0] = _m00; m[0][1] = _m01; m[0][2] = _m02; m[0][3] = _m03;
  449.                 m[1][0] = _m10; m[1][1] = _m11; m[1][2] = _m12; m[1][3] = _m13;
  450.                 m[2][0] = _m20; m[2][1] = _m21; m[2][2] = _m22; m[2][3] = _m23;
  451.                 m[3][0] = _m30; m[3][1] = _m31; m[3][2] = _m32; m[3][3] = _m33;
  452.         }
  453.  
  454.     D3DVALUE& operator()(int iRow, int iColumn) { return m[iRow][iColumn]; }
  455.     const D3DVALUE& operator()(int iRow, int iColumn) const { return m[iRow][iColumn]; }
  456. #if(DIRECT3D_VERSION >= 0x0600)
  457.     friend _D3DMATRIX operator* (const _D3DMATRIX&, const _D3DMATRIX&);
  458. #endif /* DIRECT3D_VERSION >= 0x0600 */
  459. #endif
  460. #endif /* DIRECT3D_VERSION >= 0x0500 */
  461. } D3DMATRIX, *LPD3DMATRIX;
  462.  
  463. #if (defined __cplusplus) && (defined D3D_OVERLOADS)
  464. #include "d3dvec.inl"
  465. #endif
  466.  
  467. typedef struct _D3DVIEWPORT {
  468.     DWORD       dwSize;
  469.     DWORD       dwX;
  470.     DWORD       dwY;        /* Top left */
  471.     DWORD       dwWidth;
  472.     DWORD       dwHeight;   /* Dimensions */
  473.     D3DVALUE    dvScaleX;   /* Scale homogeneous to screen */
  474.     D3DVALUE    dvScaleY;   /* Scale homogeneous to screen */
  475.     D3DVALUE    dvMaxX;     /* Min/max homogeneous x coord */
  476.     D3DVALUE    dvMaxY;     /* Min/max homogeneous y coord */
  477.     D3DVALUE    dvMinZ;
  478.     D3DVALUE    dvMaxZ;     /* Min/max homogeneous z coord */
  479. } D3DVIEWPORT, *LPD3DVIEWPORT;
  480.  
  481. #if(DIRECT3D_VERSION >= 0x0500)
  482. typedef struct _D3DVIEWPORT2 {
  483.     DWORD       dwSize;
  484.     DWORD       dwX;
  485.     DWORD       dwY;        /* Viewport Top left */
  486.     DWORD       dwWidth;
  487.     DWORD       dwHeight;   /* Viewport Dimensions */
  488.     D3DVALUE    dvClipX;        /* Top left of clip volume */
  489.     D3DVALUE    dvClipY;
  490.     D3DVALUE    dvClipWidth;    /* Clip Volume Dimensions */
  491.     D3DVALUE    dvClipHeight;
  492.     D3DVALUE    dvMinZ;         /* Min/max of clip Volume */
  493.     D3DVALUE    dvMaxZ;
  494. } D3DVIEWPORT2, *LPD3DVIEWPORT2;
  495. #endif /* DIRECT3D_VERSION >= 0x0500 */
  496.  
  497. #if(DIRECT3D_VERSION >= 0x0700)
  498. typedef struct _D3DVIEWPORT7 {
  499.     DWORD       dwX;
  500.     DWORD       dwY;            /* Viewport Top left */
  501.     DWORD       dwWidth;
  502.     DWORD       dwHeight;       /* Viewport Dimensions */
  503.     D3DVALUE    dvMinZ;         /* Min/max of clip Volume */
  504.     D3DVALUE    dvMaxZ;
  505. } D3DVIEWPORT7, *LPD3DVIEWPORT7;
  506. #endif /* DIRECT3D_VERSION >= 0x0700 */
  507.  
  508. /*
  509.  * Values for clip fields.
  510.  */
  511.  
  512. #if(DIRECT3D_VERSION >= 0x0700)
  513.  
  514. // Max number of user clipping planes, supported in D3D.
  515. #define D3DMAXUSERCLIPPLANES 32
  516.  
  517. // These bits could be ORed together to use with D3DRENDERSTATE_CLIPPLANEENABLE
  518. //
  519. #define D3DCLIPPLANE0 (1 << 0)
  520. #define D3DCLIPPLANE1 (1 << 1)
  521. #define D3DCLIPPLANE2 (1 << 2)
  522. #define D3DCLIPPLANE3 (1 << 3)
  523. #define D3DCLIPPLANE4 (1 << 4)
  524. #define D3DCLIPPLANE5 (1 << 5)
  525.  
  526. #endif /* DIRECT3D_VERSION >= 0x0700 */
  527.  
  528. #define D3DCLIP_LEFT                0x00000001L
  529. #define D3DCLIP_RIGHT               0x00000002L
  530. #define D3DCLIP_TOP             0x00000004L
  531. #define D3DCLIP_BOTTOM              0x00000008L
  532. #define D3DCLIP_FRONT               0x00000010L
  533. #define D3DCLIP_BACK                0x00000020L
  534. #define D3DCLIP_GEN0                0x00000040L
  535. #define D3DCLIP_GEN1                0x00000080L
  536. #define D3DCLIP_GEN2                0x00000100L
  537. #define D3DCLIP_GEN3                0x00000200L
  538. #define D3DCLIP_GEN4                0x00000400L
  539. #define D3DCLIP_GEN5                0x00000800L
  540.  
  541. /*
  542.  * Values for d3d status.
  543.  */
  544. #define D3DSTATUS_CLIPUNIONLEFT         D3DCLIP_LEFT
  545. #define D3DSTATUS_CLIPUNIONRIGHT        D3DCLIP_RIGHT
  546. #define D3DSTATUS_CLIPUNIONTOP          D3DCLIP_TOP
  547. #define D3DSTATUS_CLIPUNIONBOTTOM       D3DCLIP_BOTTOM
  548. #define D3DSTATUS_CLIPUNIONFRONT        D3DCLIP_FRONT
  549. #define D3DSTATUS_CLIPUNIONBACK         D3DCLIP_BACK
  550. #define D3DSTATUS_CLIPUNIONGEN0         D3DCLIP_GEN0
  551. #define D3DSTATUS_CLIPUNIONGEN1         D3DCLIP_GEN1
  552. #define D3DSTATUS_CLIPUNIONGEN2         D3DCLIP_GEN2
  553. #define D3DSTATUS_CLIPUNIONGEN3         D3DCLIP_GEN3
  554. #define D3DSTATUS_CLIPUNIONGEN4         D3DCLIP_GEN4
  555. #define D3DSTATUS_CLIPUNIONGEN5         D3DCLIP_GEN5
  556.  
  557. #define D3DSTATUS_CLIPINTERSECTIONLEFT      0x00001000L
  558. #define D3DSTATUS_CLIPINTERSECTIONRIGHT     0x00002000L
  559. #define D3DSTATUS_CLIPINTERSECTIONTOP       0x00004000L
  560. #define D3DSTATUS_CLIPINTERSECTIONBOTTOM    0x00008000L
  561. #define D3DSTATUS_CLIPINTERSECTIONFRONT     0x00010000L
  562. #define D3DSTATUS_CLIPINTERSECTIONBACK      0x00020000L
  563. #define D3DSTATUS_CLIPINTERSECTIONGEN0      0x00040000L
  564. #define D3DSTATUS_CLIPINTERSECTIONGEN1      0x00080000L
  565. #define D3DSTATUS_CLIPINTERSECTIONGEN2      0x00100000L
  566. #define D3DSTATUS_CLIPINTERSECTIONGEN3      0x00200000L
  567. #define D3DSTATUS_CLIPINTERSECTIONGEN4      0x00400000L
  568. #define D3DSTATUS_CLIPINTERSECTIONGEN5      0x00800000L
  569. #define D3DSTATUS_ZNOTVISIBLE               0x01000000L
  570. /* Do not use 0x80000000 for any status flags in future as it is reserved */
  571.  
  572. #define D3DSTATUS_CLIPUNIONALL  (       \
  573.         D3DSTATUS_CLIPUNIONLEFT |   \
  574.         D3DSTATUS_CLIPUNIONRIGHT    |   \
  575.         D3DSTATUS_CLIPUNIONTOP  |   \
  576.         D3DSTATUS_CLIPUNIONBOTTOM   |   \
  577.         D3DSTATUS_CLIPUNIONFRONT    |   \
  578.         D3DSTATUS_CLIPUNIONBACK |   \
  579.         D3DSTATUS_CLIPUNIONGEN0 |   \
  580.         D3DSTATUS_CLIPUNIONGEN1 |   \
  581.         D3DSTATUS_CLIPUNIONGEN2 |   \
  582.         D3DSTATUS_CLIPUNIONGEN3 |   \
  583.         D3DSTATUS_CLIPUNIONGEN4 |   \
  584.         D3DSTATUS_CLIPUNIONGEN5     \
  585.         )
  586.  
  587. #define D3DSTATUS_CLIPINTERSECTIONALL   (       \
  588.         D3DSTATUS_CLIPINTERSECTIONLEFT  |   \
  589.         D3DSTATUS_CLIPINTERSECTIONRIGHT |   \
  590.         D3DSTATUS_CLIPINTERSECTIONTOP   |   \
  591.         D3DSTATUS_CLIPINTERSECTIONBOTTOM    |   \
  592.         D3DSTATUS_CLIPINTERSECTIONFRONT |   \
  593.         D3DSTATUS_CLIPINTERSECTIONBACK  |   \
  594.         D3DSTATUS_CLIPINTERSECTIONGEN0  |   \
  595.         D3DSTATUS_CLIPINTERSECTIONGEN1  |   \
  596.         D3DSTATUS_CLIPINTERSECTIONGEN2  |   \
  597.         D3DSTATUS_CLIPINTERSECTIONGEN3  |   \
  598.         D3DSTATUS_CLIPINTERSECTIONGEN4  |   \
  599.         D3DSTATUS_CLIPINTERSECTIONGEN5      \
  600.         )
  601.  
  602. #define D3DSTATUS_DEFAULT   (           \
  603.         D3DSTATUS_CLIPINTERSECTIONALL   |   \
  604.         D3DSTATUS_ZNOTVISIBLE)
  605.  
  606.  
  607. /*
  608.  * Options for direct transform calls
  609.  */
  610. #define D3DTRANSFORM_CLIPPED       0x00000001l
  611. #define D3DTRANSFORM_UNCLIPPED     0x00000002l
  612.  
  613. typedef struct _D3DTRANSFORMDATA {
  614.     DWORD           dwSize;
  615.     LPVOID      lpIn;           /* Input vertices */
  616.     DWORD           dwInSize;       /* Stride of input vertices */
  617.     LPVOID      lpOut;          /* Output vertices */
  618.     DWORD           dwOutSize;      /* Stride of output vertices */
  619.     LPD3DHVERTEX    lpHOut;         /* Output homogeneous vertices */
  620.     DWORD           dwClip;         /* Clipping hint */
  621.     DWORD           dwClipIntersection;
  622.     DWORD           dwClipUnion;    /* Union of all clip flags */
  623.     D3DRECT         drExtent;       /* Extent of transformed vertices */
  624. } D3DTRANSFORMDATA, *LPD3DTRANSFORMDATA;
  625.  
  626. /*
  627.  * Structure defining position and direction properties for lighting.
  628.  */
  629. typedef struct _D3DLIGHTINGELEMENT {
  630.     D3DVECTOR dvPosition;           /* Lightable point in model space */
  631.     D3DVECTOR dvNormal;             /* Normalised unit vector */
  632. } D3DLIGHTINGELEMENT, *LPD3DLIGHTINGELEMENT;
  633.  
  634. /*
  635.  * Structure defining material properties for lighting.
  636.  */
  637. typedef struct _D3DMATERIAL {
  638.     DWORD           dwSize;
  639.     union {
  640.     D3DCOLORVALUE   diffuse;        /* Diffuse color RGBA */
  641.     D3DCOLORVALUE   dcvDiffuse;
  642.     };
  643.     union {
  644.     D3DCOLORVALUE   ambient;        /* Ambient color RGB */
  645.     D3DCOLORVALUE   dcvAmbient;
  646.     };
  647.     union {
  648.     D3DCOLORVALUE   specular;       /* Specular 'shininess' */
  649.     D3DCOLORVALUE   dcvSpecular;
  650.     };
  651.     union {
  652.     D3DCOLORVALUE   emissive;       /* Emissive color RGB */
  653.     D3DCOLORVALUE   dcvEmissive;
  654.     };
  655.     union {
  656.     D3DVALUE        power;          /* Sharpness if specular highlight */
  657.     D3DVALUE        dvPower;
  658.     };
  659.     D3DTEXTUREHANDLE    hTexture;       /* Handle to texture map */
  660.     DWORD           dwRampSize;
  661. } D3DMATERIAL, *LPD3DMATERIAL;
  662.  
  663. #if(DIRECT3D_VERSION >= 0x0700)
  664.  
  665. typedef struct _D3DMATERIAL7 {
  666.     union {
  667.     D3DCOLORVALUE   diffuse;        /* Diffuse color RGBA */
  668.     D3DCOLORVALUE   dcvDiffuse;
  669.     };
  670.     union {
  671.     D3DCOLORVALUE   ambient;        /* Ambient color RGB */
  672.     D3DCOLORVALUE   dcvAmbient;
  673.     };
  674.     union {
  675.     D3DCOLORVALUE   specular;       /* Specular 'shininess' */
  676.     D3DCOLORVALUE   dcvSpecular;
  677.     };
  678.     union {
  679.     D3DCOLORVALUE   emissive;       /* Emissive color RGB */
  680.     D3DCOLORVALUE   dcvEmissive;
  681.     };
  682.     union {
  683.     D3DVALUE        power;          /* Sharpness if specular highlight */
  684.     D3DVALUE        dvPower;
  685.     };
  686. } D3DMATERIAL7, *LPD3DMATERIAL7;
  687.  
  688. #endif /* DIRECT3D_VERSION >= 0x0700 */
  689.  
  690. typedef enum _D3DLIGHTTYPE {
  691.     D3DLIGHT_POINT          = 1,
  692.     D3DLIGHT_SPOT           = 2,
  693.     D3DLIGHT_DIRECTIONAL    = 3,
  694. // Note: The following light type (D3DLIGHT_PARALLELPOINT)
  695. // is no longer supported from D3D for DX7 onwards.
  696.     D3DLIGHT_PARALLELPOINT  = 4,
  697. #if(DIRECT3D_VERSION < 0x0500) // For backward compatible headers
  698.     D3DLIGHT_GLSPOT         = 5,
  699. #endif
  700.     D3DLIGHT_FORCE_DWORD    = 0x7fffffff, /* force 32-bit size enum */
  701. } D3DLIGHTTYPE;
  702.  
  703. /*
  704.  * Structure defining a light source and its properties.
  705.  */
  706. typedef struct _D3DLIGHT {
  707.     DWORD           dwSize;
  708.     D3DLIGHTTYPE    dltType;            /* Type of light source */
  709.     D3DCOLORVALUE   dcvColor;           /* Color of light */
  710.     D3DVECTOR       dvPosition;         /* Position in world space */
  711.     D3DVECTOR       dvDirection;        /* Direction in world space */
  712.     D3DVALUE        dvRange;            /* Cutoff range */
  713.     D3DVALUE        dvFalloff;          /* Falloff */
  714.     D3DVALUE        dvAttenuation0;     /* Constant attenuation */
  715.     D3DVALUE        dvAttenuation1;     /* Linear attenuation */
  716.     D3DVALUE        dvAttenuation2;     /* Quadratic attenuation */
  717.     D3DVALUE        dvTheta;            /* Inner angle of spotlight cone */
  718.     D3DVALUE        dvPhi;              /* Outer angle of spotlight cone */
  719. } D3DLIGHT, *LPD3DLIGHT;
  720.  
  721. #if(DIRECT3D_VERSION >= 0x0700)
  722.  
  723. typedef struct _D3DLIGHT7 {
  724.     D3DLIGHTTYPE    dltType;            /* Type of light source */
  725.     D3DCOLORVALUE   dcvDiffuse;         /* Diffuse color of light */
  726.     D3DCOLORVALUE   dcvSpecular;        /* Specular color of light */
  727.     D3DCOLORVALUE   dcvAmbient;         /* Ambient color of light */
  728.     D3DVECTOR       dvPosition;         /* Position in world space */
  729.     D3DVECTOR       dvDirection;        /* Direction in world space */
  730.     D3DVALUE        dvRange;            /* Cutoff range */
  731.     D3DVALUE        dvFalloff;          /* Falloff */
  732.     D3DVALUE        dvAttenuation0;     /* Constant attenuation */
  733.     D3DVALUE        dvAttenuation1;     /* Linear attenuation */
  734.     D3DVALUE        dvAttenuation2;     /* Quadratic attenuation */
  735.     D3DVALUE        dvTheta;            /* Inner angle of spotlight cone */
  736.     D3DVALUE        dvPhi;              /* Outer angle of spotlight cone */
  737. } D3DLIGHT7, *LPD3DLIGHT7;
  738.  
  739. #endif /* DIRECT3D_VERSION >= 0x0700 */
  740.  
  741. #if(DIRECT3D_VERSION >= 0x0500)
  742. /*
  743.  * Structure defining a light source and its properties.
  744.  */
  745.  
  746. /* flags bits */
  747. #define D3DLIGHT_ACTIVE         0x00000001
  748. #define D3DLIGHT_NO_SPECULAR    0x00000002
  749. #define D3DLIGHT_ALL (D3DLIGHT_ACTIVE | D3DLIGHT_NO_SPECULAR)
  750.  
  751. /* maximum valid light range */
  752. #define D3DLIGHT_RANGE_MAX      ((float)sqrt(FLT_MAX))
  753.  
  754. typedef struct _D3DLIGHT2 {
  755.     DWORD           dwSize;
  756.     D3DLIGHTTYPE    dltType;        /* Type of light source */
  757.     D3DCOLORVALUE   dcvColor;       /* Color of light */
  758.     D3DVECTOR       dvPosition;     /* Position in world space */
  759.     D3DVECTOR       dvDirection;    /* Direction in world space */
  760.     D3DVALUE        dvRange;        /* Cutoff range */
  761.     D3DVALUE        dvFalloff;      /* Falloff */
  762.     D3DVALUE        dvAttenuation0; /* Constant attenuation */
  763.     D3DVALUE        dvAttenuation1; /* Linear attenuation */
  764.     D3DVALUE        dvAttenuation2; /* Quadratic attenuation */
  765.     D3DVALUE        dvTheta;        /* Inner angle of spotlight cone */
  766.     D3DVALUE        dvPhi;          /* Outer angle of spotlight cone */
  767.     DWORD           dwFlags;
  768. } D3DLIGHT2, *LPD3DLIGHT2;
  769.  
  770. #endif /* DIRECT3D_VERSION >= 0x0500 */
  771. typedef struct _D3DLIGHTDATA {
  772.     DWORD                dwSize;
  773.     LPD3DLIGHTINGELEMENT lpIn;      /* Input positions and normals */
  774.     DWORD                dwInSize;  /* Stride of input elements */
  775.     LPD3DTLVERTEX        lpOut;     /* Output colors */
  776.     DWORD                dwOutSize; /* Stride of output colors */
  777. } D3DLIGHTDATA, *LPD3DLIGHTDATA;
  778.  
  779. #if(DIRECT3D_VERSION >= 0x0500)
  780. /*
  781.  * Before DX5, these values were in an enum called
  782.  * D3DCOLORMODEL. This was not correct, since they are
  783.  * bit flags. A driver can surface either or both flags
  784.  * in the dcmColorModel member of D3DDEVICEDESC.
  785.  */
  786. #define D3DCOLOR_MONO   1
  787. #define D3DCOLOR_RGB    2
  788.  
  789. typedef DWORD D3DCOLORMODEL;
  790. #endif /* DIRECT3D_VERSION >= 0x0500 */
  791.  
  792. /*
  793.  * Options for clearing
  794.  */
  795. #define D3DCLEAR_TARGET            0x00000001l  /* Clear target surface */
  796. #define D3DCLEAR_ZBUFFER           0x00000002l  /* Clear target z buffer */
  797. #if(DIRECT3D_VERSION >= 0x0600)
  798. #define D3DCLEAR_STENCIL           0x00000004l  /* Clear stencil planes */
  799. #endif /* DIRECT3D_VERSION >= 0x0600 */
  800.  
  801. /*
  802.  * Execute buffers are allocated via Direct3D.  These buffers may then
  803.  * be filled by the application with instructions to execute along with
  804.  * vertex data.
  805.  */
  806.  
  807. /*
  808.  * Supported op codes for execute instructions.
  809.  */
  810. typedef enum _D3DOPCODE {
  811.     D3DOP_POINT                 = 1,
  812.     D3DOP_LINE                  = 2,
  813.     D3DOP_TRIANGLE      = 3,
  814.     D3DOP_MATRIXLOAD        = 4,
  815.     D3DOP_MATRIXMULTIPLY    = 5,
  816.     D3DOP_STATETRANSFORM        = 6,
  817.     D3DOP_STATELIGHT        = 7,
  818.     D3DOP_STATERENDER       = 8,
  819.     D3DOP_PROCESSVERTICES       = 9,
  820.     D3DOP_TEXTURELOAD       = 10,
  821.     D3DOP_EXIT                  = 11,
  822.     D3DOP_BRANCHFORWARD     = 12,
  823.     D3DOP_SPAN          = 13,
  824.     D3DOP_SETSTATUS     = 14,
  825. #if(DIRECT3D_VERSION >= 0x0500)
  826.     D3DOP_FORCE_DWORD           = 0x7fffffff, /* force 32-bit size enum */
  827. #endif /* DIRECT3D_VERSION >= 0x0500 */
  828. } D3DOPCODE;
  829.  
  830. typedef struct _D3DINSTRUCTION {
  831.     BYTE bOpcode;   /* Instruction opcode */
  832.     BYTE bSize;     /* Size of each instruction data unit */
  833.     WORD wCount;    /* Count of instruction data units to follow */
  834. } D3DINSTRUCTION, *LPD3DINSTRUCTION;
  835.  
  836. /*
  837.  * Structure for texture loads
  838.  */
  839. typedef struct _D3DTEXTURELOAD {
  840.     D3DTEXTUREHANDLE hDestTexture;
  841.     D3DTEXTUREHANDLE hSrcTexture;
  842. } D3DTEXTURELOAD, *LPD3DTEXTURELOAD;
  843.  
  844. /*
  845.  * Structure for picking
  846.  */
  847. typedef struct _D3DPICKRECORD {
  848.     BYTE     bOpcode;
  849.     BYTE     bPad;
  850.     DWORD    dwOffset;
  851.     D3DVALUE dvZ;
  852. } D3DPICKRECORD, *LPD3DPICKRECORD;
  853.  
  854. /*
  855.  * The following defines the rendering states which can be set in the
  856.  * execute buffer.
  857.  */
  858.  
  859. typedef enum _D3DSHADEMODE {
  860.     D3DSHADE_FLAT              = 1,
  861.     D3DSHADE_GOURAUD           = 2,
  862.     D3DSHADE_PHONG             = 3,
  863. #if(DIRECT3D_VERSION >= 0x0500)
  864.     D3DSHADE_FORCE_DWORD       = 0x7fffffff, /* force 32-bit size enum */
  865. #endif /* DIRECT3D_VERSION >= 0x0500 */
  866. } D3DSHADEMODE;
  867.  
  868. typedef enum _D3DFILLMODE {
  869.     D3DFILL_POINT          = 1,
  870.     D3DFILL_WIREFRAME          = 2,
  871.     D3DFILL_SOLID          = 3,
  872. #if(DIRECT3D_VERSION >= 0x0500)
  873.     D3DFILL_FORCE_DWORD        = 0x7fffffff, /* force 32-bit size enum */
  874. #endif /* DIRECT3D_VERSION >= 0x0500 */
  875. } D3DFILLMODE;
  876.  
  877. typedef struct _D3DLINEPATTERN {
  878.     WORD    wRepeatFactor;
  879.     WORD    wLinePattern;
  880. } D3DLINEPATTERN;
  881.  
  882. typedef enum _D3DTEXTUREFILTER {
  883.     D3DFILTER_NEAREST          = 1,
  884.     D3DFILTER_LINEAR           = 2,
  885.     D3DFILTER_MIPNEAREST       = 3,
  886.     D3DFILTER_MIPLINEAR        = 4,
  887.     D3DFILTER_LINEARMIPNEAREST = 5,
  888.     D3DFILTER_LINEARMIPLINEAR  = 6,
  889. #if(DIRECT3D_VERSION >= 0x0500)
  890.     D3DFILTER_FORCE_DWORD      = 0x7fffffff, /* force 32-bit size enum */
  891. #endif /* DIRECT3D_VERSION >= 0x0500 */
  892. } D3DTEXTUREFILTER;
  893.  
  894. typedef enum _D3DBLEND {
  895.     D3DBLEND_ZERO              = 1,
  896.     D3DBLEND_ONE               = 2,
  897.     D3DBLEND_SRCCOLOR          = 3,
  898.     D3DBLEND_INVSRCCOLOR       = 4,
  899.     D3DBLEND_SRCALPHA          = 5,
  900.     D3DBLEND_INVSRCALPHA       = 6,
  901.     D3DBLEND_DESTALPHA         = 7,
  902.     D3DBLEND_INVDESTALPHA      = 8,
  903.     D3DBLEND_DESTCOLOR         = 9,
  904.     D3DBLEND_INVDESTCOLOR      = 10,
  905.     D3DBLEND_SRCALPHASAT       = 11,
  906.     D3DBLEND_BOTHSRCALPHA      = 12,
  907.     D3DBLEND_BOTHINVSRCALPHA   = 13,
  908. #if(DIRECT3D_VERSION >= 0x0500)
  909.     D3DBLEND_FORCE_DWORD       = 0x7fffffff, /* force 32-bit size enum */
  910. #endif /* DIRECT3D_VERSION >= 0x0500 */
  911. } D3DBLEND;
  912.  
  913. typedef enum _D3DTEXTUREBLEND {
  914.     D3DTBLEND_DECAL            = 1,
  915.     D3DTBLEND_MODULATE         = 2,
  916.     D3DTBLEND_DECALALPHA       = 3,
  917.     D3DTBLEND_MODULATEALPHA    = 4,
  918.     D3DTBLEND_DECALMASK        = 5,
  919.     D3DTBLEND_MODULATEMASK     = 6,
  920.     D3DTBLEND_COPY             = 7,
  921. #if(DIRECT3D_VERSION >= 0x0500)
  922.     D3DTBLEND_ADD              = 8,
  923.     D3DTBLEND_FORCE_DWORD      = 0x7fffffff, /* force 32-bit size enum */
  924. #endif /* DIRECT3D_VERSION >= 0x0500 */
  925. } D3DTEXTUREBLEND;
  926.  
  927. typedef enum _D3DTEXTUREADDRESS {
  928.     D3DTADDRESS_WRAP           = 1,
  929.     D3DTADDRESS_MIRROR         = 2,
  930.     D3DTADDRESS_CLAMP          = 3,
  931. #if(DIRECT3D_VERSION >= 0x0500)
  932.     D3DTADDRESS_BORDER         = 4,
  933.     D3DTADDRESS_FORCE_DWORD    = 0x7fffffff, /* force 32-bit size enum */
  934. #endif /* DIRECT3D_VERSION >= 0x0500 */
  935. } D3DTEXTUREADDRESS;
  936.  
  937. typedef enum _D3DCULL {
  938.     D3DCULL_NONE               = 1,
  939.     D3DCULL_CW                 = 2,
  940.     D3DCULL_CCW                = 3,
  941. #if(DIRECT3D_VERSION >= 0x0500)
  942.     D3DCULL_FORCE_DWORD        = 0x7fffffff, /* force 32-bit size enum */
  943. #endif /* DIRECT3D_VERSION >= 0x0500 */
  944. } D3DCULL;
  945.  
  946. typedef enum _D3DCMPFUNC {
  947.     D3DCMP_NEVER               = 1,
  948.     D3DCMP_LESS                = 2,
  949.     D3DCMP_EQUAL               = 3,
  950.     D3DCMP_LESSEQUAL           = 4,
  951.     D3DCMP_GREATER             = 5,
  952.     D3DCMP_NOTEQUAL            = 6,
  953.     D3DCMP_GREATEREQUAL        = 7,
  954.     D3DCMP_ALWAYS              = 8,
  955. #if(DIRECT3D_VERSION >= 0x0500)
  956.     D3DCMP_FORCE_DWORD         = 0x7fffffff, /* force 32-bit size enum */
  957. #endif /* DIRECT3D_VERSION >= 0x0500 */
  958. } D3DCMPFUNC;
  959.  
  960. #if(DIRECT3D_VERSION >= 0x0600)
  961. typedef enum _D3DSTENCILOP {
  962.     D3DSTENCILOP_KEEP           = 1,
  963.     D3DSTENCILOP_ZERO           = 2,
  964.     D3DSTENCILOP_REPLACE        = 3,
  965.     D3DSTENCILOP_INCRSAT        = 4,
  966.     D3DSTENCILOP_DECRSAT        = 5,
  967.     D3DSTENCILOP_INVERT         = 6,
  968.     D3DSTENCILOP_INCR           = 7,
  969.     D3DSTENCILOP_DECR           = 8,
  970.     D3DSTENCILOP_FORCE_DWORD    = 0x7fffffff, /* force 32-bit size enum */
  971. } D3DSTENCILOP;
  972. #endif /* DIRECT3D_VERSION >= 0x0600 */
  973.  
  974. typedef enum _D3DFOGMODE {
  975.     D3DFOG_NONE                = 0,
  976.     D3DFOG_EXP                 = 1,
  977.     D3DFOG_EXP2                = 2,
  978. #if(DIRECT3D_VERSION >= 0x0500)
  979.     D3DFOG_LINEAR              = 3,
  980.     D3DFOG_FORCE_DWORD         = 0x7fffffff, /* force 32-bit size enum */
  981. #endif /* DIRECT3D_VERSION >= 0x0500 */
  982. } D3DFOGMODE;
  983.  
  984. #if(DIRECT3D_VERSION >= 0x0600)
  985. typedef enum _D3DZBUFFERTYPE {
  986.     D3DZB_FALSE                 = 0,
  987.     D3DZB_TRUE                  = 1, // Z buffering
  988.     D3DZB_USEW                  = 2, // W buffering
  989.     D3DZB_FORCE_DWORD           = 0x7fffffff, /* force 32-bit size enum */
  990. } D3DZBUFFERTYPE;
  991. #endif /* DIRECT3D_VERSION >= 0x0600 */
  992.  
  993. #if(DIRECT3D_VERSION >= 0x0500)
  994. typedef enum _D3DANTIALIASMODE {
  995.     D3DANTIALIAS_NONE          = 0,
  996.     D3DANTIALIAS_SORTDEPENDENT = 1,
  997.     D3DANTIALIAS_SORTINDEPENDENT = 2,
  998.     D3DANTIALIAS_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  999. } D3DANTIALIASMODE;
  1000.  
  1001. // Vertex types supported by Direct3D
  1002. typedef enum _D3DVERTEXTYPE {
  1003.     D3DVT_VERTEX        = 1,
  1004.     D3DVT_LVERTEX       = 2,
  1005.     D3DVT_TLVERTEX      = 3,
  1006.     D3DVT_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  1007. } D3DVERTEXTYPE;
  1008.  
  1009. // Primitives supported by draw-primitive API
  1010. typedef enum _D3DPRIMITIVETYPE {
  1011.     D3DPT_POINTLIST     = 1,
  1012.     D3DPT_LINELIST      = 2,
  1013.     D3DPT_LINESTRIP     = 3,
  1014.     D3DPT_TRIANGLELIST  = 4,
  1015.     D3DPT_TRIANGLESTRIP = 5,
  1016.     D3DPT_TRIANGLEFAN   = 6,
  1017.     D3DPT_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  1018. } D3DPRIMITIVETYPE;
  1019.  
  1020. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1021. /*
  1022.  * Amount to add to a state to generate the override for that state.
  1023.  */
  1024. #define D3DSTATE_OVERRIDE_BIAS      256
  1025.  
  1026. /*
  1027.  * A state which sets the override flag for the specified state type.
  1028.  */
  1029. #define D3DSTATE_OVERRIDE(type) (D3DRENDERSTATETYPE)(((DWORD) (type) + D3DSTATE_OVERRIDE_BIAS))
  1030.  
  1031. typedef enum _D3DTRANSFORMSTATETYPE {
  1032.     D3DTRANSFORMSTATE_WORLD         = 1,
  1033.     D3DTRANSFORMSTATE_VIEW          = 2,
  1034.     D3DTRANSFORMSTATE_PROJECTION    = 3,
  1035. #if(DIRECT3D_VERSION >= 0x0700)
  1036.     D3DTRANSFORMSTATE_WORLD1        = 4,  // 2nd matrix to blend
  1037.     D3DTRANSFORMSTATE_WORLD2        = 5,  // 3rd matrix to blend
  1038.     D3DTRANSFORMSTATE_WORLD3        = 6,  // 4th matrix to blend
  1039.     D3DTRANSFORMSTATE_TEXTURE0      = 16,
  1040.     D3DTRANSFORMSTATE_TEXTURE1      = 17,
  1041.     D3DTRANSFORMSTATE_TEXTURE2      = 18,
  1042.     D3DTRANSFORMSTATE_TEXTURE3      = 19,
  1043.     D3DTRANSFORMSTATE_TEXTURE4      = 20,
  1044.     D3DTRANSFORMSTATE_TEXTURE5      = 21,
  1045.     D3DTRANSFORMSTATE_TEXTURE6      = 22,
  1046.     D3DTRANSFORMSTATE_TEXTURE7      = 23,
  1047. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1048. #if(DIRECT3D_VERSION >= 0x0500)
  1049.     D3DTRANSFORMSTATE_FORCE_DWORD     = 0x7fffffff, /* force 32-bit size enum */
  1050. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1051. } D3DTRANSFORMSTATETYPE;
  1052.  
  1053. typedef enum _D3DLIGHTSTATETYPE {
  1054.     D3DLIGHTSTATE_MATERIAL          = 1,
  1055.     D3DLIGHTSTATE_AMBIENT           = 2,
  1056.     D3DLIGHTSTATE_COLORMODEL        = 3,
  1057.     D3DLIGHTSTATE_FOGMODE           = 4,
  1058.     D3DLIGHTSTATE_FOGSTART          = 5,
  1059.     D3DLIGHTSTATE_FOGEND            = 6,
  1060.     D3DLIGHTSTATE_FOGDENSITY        = 7,
  1061. #if(DIRECT3D_VERSION >= 0x0600)
  1062.     D3DLIGHTSTATE_COLORVERTEX       = 8,
  1063. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1064. #if(DIRECT3D_VERSION >= 0x0500)
  1065.     D3DLIGHTSTATE_FORCE_DWORD         = 0x7fffffff, /* force 32-bit size enum */
  1066. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1067. } D3DLIGHTSTATETYPE;
  1068.  
  1069. typedef enum _D3DRENDERSTATETYPE {
  1070.     D3DRENDERSTATE_ANTIALIAS          = 2,    /* D3DANTIALIASMODE */
  1071.     D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4,    /* TRUE for perspective correction */
  1072.     D3DRENDERSTATE_ZENABLE            = 7,    /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */
  1073.     D3DRENDERSTATE_FILLMODE           = 8,    /* D3DFILL_MODE        */
  1074.     D3DRENDERSTATE_SHADEMODE          = 9,    /* D3DSHADEMODE */
  1075.     D3DRENDERSTATE_LINEPATTERN        = 10,   /* D3DLINEPATTERN */
  1076.     D3DRENDERSTATE_ZWRITEENABLE       = 14,   /* TRUE to enable z writes */
  1077.     D3DRENDERSTATE_ALPHATESTENABLE    = 15,   /* TRUE to enable alpha tests */
  1078.     D3DRENDERSTATE_LASTPIXEL          = 16,   /* TRUE for last-pixel on lines */
  1079.     D3DRENDERSTATE_SRCBLEND           = 19,   /* D3DBLEND */
  1080.     D3DRENDERSTATE_DESTBLEND          = 20,   /* D3DBLEND */
  1081.     D3DRENDERSTATE_CULLMODE           = 22,   /* D3DCULL */
  1082.     D3DRENDERSTATE_ZFUNC              = 23,   /* D3DCMPFUNC */
  1083.     D3DRENDERSTATE_ALPHAREF           = 24,   /* D3DFIXED */
  1084.     D3DRENDERSTATE_ALPHAFUNC          = 25,   /* D3DCMPFUNC */
  1085.     D3DRENDERSTATE_DITHERENABLE       = 26,   /* TRUE to enable dithering */
  1086. #if(DIRECT3D_VERSION >= 0x0500)
  1087.     D3DRENDERSTATE_ALPHABLENDENABLE   = 27,   /* TRUE to enable alpha blending */
  1088. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1089.     D3DRENDERSTATE_FOGENABLE          = 28,   /* TRUE to enable fog blending */
  1090.     D3DRENDERSTATE_SPECULARENABLE     = 29,   /* TRUE to enable specular */
  1091.     D3DRENDERSTATE_ZVISIBLE           = 30,   /* TRUE to enable z checking */
  1092.     D3DRENDERSTATE_STIPPLEDALPHA      = 33,   /* TRUE to enable stippled alpha (RGB device only) */
  1093.     D3DRENDERSTATE_FOGCOLOR           = 34,   /* D3DCOLOR */
  1094.     D3DRENDERSTATE_FOGTABLEMODE       = 35,   /* D3DFOGMODE */
  1095. #if(DIRECT3D_VERSION >= 0x0700)
  1096.     D3DRENDERSTATE_FOGSTART           = 36,   /* Fog start (for both vertex and pixel fog) */
  1097.     D3DRENDERSTATE_FOGEND             = 37,   /* Fog end      */
  1098.     D3DRENDERSTATE_FOGDENSITY         = 38,   /* Fog density  */
  1099. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1100. #if(DIRECT3D_VERSION >= 0x0500)
  1101.     D3DRENDERSTATE_EDGEANTIALIAS      = 40,   /* TRUE to enable edge antialiasing */
  1102.     D3DRENDERSTATE_COLORKEYENABLE     = 41,   /* TRUE to enable source colorkeyed textures */
  1103.     D3DRENDERSTATE_ZBIAS              = 47,   /* LONG Z bias */
  1104.     D3DRENDERSTATE_RANGEFOGENABLE     = 48,   /* Enables range-based fog */
  1105. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1106.  
  1107. #if(DIRECT3D_VERSION >= 0x0600)
  1108.     D3DRENDERSTATE_STENCILENABLE      = 52,   /* BOOL enable/disable stenciling */
  1109.     D3DRENDERSTATE_STENCILFAIL        = 53,   /* D3DSTENCILOP to do if stencil test fails */
  1110.     D3DRENDERSTATE_STENCILZFAIL       = 54,   /* D3DSTENCILOP to do if stencil test passes and Z test fails */
  1111.     D3DRENDERSTATE_STENCILPASS        = 55,   /* D3DSTENCILOP to do if both stencil and Z tests pass */
  1112.     D3DRENDERSTATE_STENCILFUNC        = 56,   /* D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */
  1113.     D3DRENDERSTATE_STENCILREF         = 57,   /* Reference value used in stencil test */
  1114.     D3DRENDERSTATE_STENCILMASK        = 58,   /* Mask value used in stencil test */
  1115.     D3DRENDERSTATE_STENCILWRITEMASK   = 59,   /* Write mask applied to values written to stencil buffer */
  1116.     D3DRENDERSTATE_TEXTUREFACTOR      = 60,   /* D3DCOLOR used for multi-texture blend */
  1117. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1118.  
  1119. #if(DIRECT3D_VERSION >= 0x0600)
  1120.  
  1121.     /*
  1122.      * 128 values [128, 255] are reserved for texture coordinate wrap flags.
  1123.      * These are constructed with the D3DWRAP_U and D3DWRAP_V macros. Using
  1124.      * a flags word preserves forward compatibility with texture coordinates
  1125.      * that are >2D.
  1126.      */
  1127.     D3DRENDERSTATE_WRAP0              = 128,  /* wrap for 1st texture coord. set */
  1128.     D3DRENDERSTATE_WRAP1              = 129,  /* wrap for 2nd texture coord. set */
  1129.     D3DRENDERSTATE_WRAP2              = 130,  /* wrap for 3rd texture coord. set */
  1130.     D3DRENDERSTATE_WRAP3              = 131,  /* wrap for 4th texture coord. set */
  1131.     D3DRENDERSTATE_WRAP4              = 132,  /* wrap for 5th texture coord. set */
  1132.     D3DRENDERSTATE_WRAP5              = 133,  /* wrap for 6th texture coord. set */
  1133.     D3DRENDERSTATE_WRAP6              = 134,  /* wrap for 7th texture coord. set */
  1134.     D3DRENDERSTATE_WRAP7              = 135,  /* wrap for 8th texture coord. set */
  1135. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1136. #if(DIRECT3D_VERSION >= 0x0700)
  1137.     D3DRENDERSTATE_CLIPPING            = 136,
  1138.     D3DRENDERSTATE_LIGHTING            = 137,
  1139.     D3DRENDERSTATE_EXTENTS             = 138,
  1140.     D3DRENDERSTATE_AMBIENT             = 139,
  1141.     D3DRENDERSTATE_FOGVERTEXMODE       = 140,
  1142.     D3DRENDERSTATE_COLORVERTEX         = 141,
  1143.     D3DRENDERSTATE_LOCALVIEWER         = 142,
  1144.     D3DRENDERSTATE_NORMALIZENORMALS    = 143,
  1145.     D3DRENDERSTATE_COLORKEYBLENDENABLE = 144,
  1146.     D3DRENDERSTATE_DIFFUSEMATERIALSOURCE    = 145,
  1147.     D3DRENDERSTATE_SPECULARMATERIALSOURCE   = 146,
  1148.     D3DRENDERSTATE_AMBIENTMATERIALSOURCE    = 147,
  1149.     D3DRENDERSTATE_EMISSIVEMATERIALSOURCE   = 148,
  1150.     D3DRENDERSTATE_VERTEXBLEND              = 151,
  1151.     D3DRENDERSTATE_CLIPPLANEENABLE          = 152,
  1152.  
  1153. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1154.  
  1155. //
  1156. // retired renderstates - not supported for DX7 interfaces
  1157. //
  1158.     D3DRENDERSTATE_TEXTUREHANDLE      = 1,    /* Texture handle for legacy interfaces (Texture,Texture2) */
  1159.     D3DRENDERSTATE_TEXTUREADDRESS     = 3,    /* D3DTEXTUREADDRESS  */
  1160.     D3DRENDERSTATE_WRAPU              = 5,    /* TRUE for wrapping in u */
  1161.     D3DRENDERSTATE_WRAPV              = 6,    /* TRUE for wrapping in v */
  1162.     D3DRENDERSTATE_MONOENABLE         = 11,   /* TRUE to enable mono rasterization */
  1163.     D3DRENDERSTATE_ROP2               = 12,   /* ROP2 */
  1164.     D3DRENDERSTATE_PLANEMASK          = 13,   /* DWORD physical plane mask */
  1165.     D3DRENDERSTATE_TEXTUREMAG         = 17,   /* D3DTEXTUREFILTER */
  1166.     D3DRENDERSTATE_TEXTUREMIN         = 18,   /* D3DTEXTUREFILTER */
  1167.     D3DRENDERSTATE_TEXTUREMAPBLEND    = 21,   /* D3DTEXTUREBLEND */
  1168.     D3DRENDERSTATE_SUBPIXEL           = 31,   /* TRUE to enable subpixel correction */
  1169.     D3DRENDERSTATE_SUBPIXELX          = 32,   /* TRUE to enable correction in X only */
  1170.     D3DRENDERSTATE_STIPPLEENABLE      = 39,   /* TRUE to enable stippling */
  1171. #if(DIRECT3D_VERSION >= 0x0500)
  1172.     D3DRENDERSTATE_BORDERCOLOR        = 43,   /* Border color for texturing w/border */
  1173.     D3DRENDERSTATE_TEXTUREADDRESSU    = 44,   /* Texture addressing mode for U coordinate */
  1174.     D3DRENDERSTATE_TEXTUREADDRESSV    = 45,   /* Texture addressing mode for V coordinate */
  1175.     D3DRENDERSTATE_MIPMAPLODBIAS      = 46,   /* D3DVALUE Mipmap LOD bias */
  1176.     D3DRENDERSTATE_ANISOTROPY         = 49,   /* Max. anisotropy. 1 = no anisotropy */
  1177. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1178.     D3DRENDERSTATE_FLUSHBATCH         = 50,   /* Explicit flush for DP batching (DX5 Only) */
  1179. #if(DIRECT3D_VERSION >= 0x0600)
  1180.     D3DRENDERSTATE_TRANSLUCENTSORTINDEPENDENT=51, /* BOOL enable sort-independent transparency */
  1181. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1182.     D3DRENDERSTATE_STIPPLEPATTERN00   = 64,   /* Stipple pattern 01...  */
  1183.     D3DRENDERSTATE_STIPPLEPATTERN01   = 65,
  1184.     D3DRENDERSTATE_STIPPLEPATTERN02   = 66,
  1185.     D3DRENDERSTATE_STIPPLEPATTERN03   = 67,
  1186.     D3DRENDERSTATE_STIPPLEPATTERN04   = 68,
  1187.     D3DRENDERSTATE_STIPPLEPATTERN05   = 69,
  1188.     D3DRENDERSTATE_STIPPLEPATTERN06   = 70,
  1189.     D3DRENDERSTATE_STIPPLEPATTERN07   = 71,
  1190.     D3DRENDERSTATE_STIPPLEPATTERN08   = 72,
  1191.     D3DRENDERSTATE_STIPPLEPATTERN09   = 73,
  1192.     D3DRENDERSTATE_STIPPLEPATTERN10   = 74,
  1193.     D3DRENDERSTATE_STIPPLEPATTERN11   = 75,
  1194.     D3DRENDERSTATE_STIPPLEPATTERN12   = 76,
  1195.     D3DRENDERSTATE_STIPPLEPATTERN13   = 77,
  1196.     D3DRENDERSTATE_STIPPLEPATTERN14   = 78,
  1197.     D3DRENDERSTATE_STIPPLEPATTERN15   = 79,
  1198.     D3DRENDERSTATE_STIPPLEPATTERN16   = 80,
  1199.     D3DRENDERSTATE_STIPPLEPATTERN17   = 81,
  1200.     D3DRENDERSTATE_STIPPLEPATTERN18   = 82,
  1201.     D3DRENDERSTATE_STIPPLEPATTERN19   = 83,
  1202.     D3DRENDERSTATE_STIPPLEPATTERN20   = 84,
  1203.     D3DRENDERSTATE_STIPPLEPATTERN21   = 85,
  1204.     D3DRENDERSTATE_STIPPLEPATTERN22   = 86,
  1205.     D3DRENDERSTATE_STIPPLEPATTERN23   = 87,
  1206.     D3DRENDERSTATE_STIPPLEPATTERN24   = 88,
  1207.     D3DRENDERSTATE_STIPPLEPATTERN25   = 89,
  1208.     D3DRENDERSTATE_STIPPLEPATTERN26   = 90,
  1209.     D3DRENDERSTATE_STIPPLEPATTERN27   = 91,
  1210.     D3DRENDERSTATE_STIPPLEPATTERN28   = 92,
  1211.     D3DRENDERSTATE_STIPPLEPATTERN29   = 93,
  1212.     D3DRENDERSTATE_STIPPLEPATTERN30   = 94,
  1213.     D3DRENDERSTATE_STIPPLEPATTERN31   = 95,
  1214.  
  1215. //
  1216. // retired renderstate names - the values are still used under new naming conventions
  1217. //
  1218.     D3DRENDERSTATE_FOGTABLESTART      = 36,   /* Fog table start    */
  1219.     D3DRENDERSTATE_FOGTABLEEND        = 37,   /* Fog table end      */
  1220.     D3DRENDERSTATE_FOGTABLEDENSITY    = 38,   /* Fog table density  */
  1221.  
  1222. #if(DIRECT3D_VERSION >= 0x0500)
  1223.     D3DRENDERSTATE_FORCE_DWORD        = 0x7fffffff, /* force 32-bit size enum */
  1224. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1225. } D3DRENDERSTATETYPE;
  1226.  
  1227. // Values for material source
  1228. typedef enum _D3DMATERIALCOLORSOURCE
  1229. {
  1230.     D3DMCS_MATERIAL = 0,                // Color from material is used
  1231.     D3DMCS_COLOR1   = 1,                // Diffuse vertex color is used
  1232.     D3DMCS_COLOR2   = 2,                // Specular vertex color is used
  1233.     D3DMCS_FORCE_DWORD = 0x7fffffff,    // force 32-bit size enum
  1234. } D3DMATERIALCOLORSOURCE;
  1235.  
  1236.  
  1237. #if(DIRECT3D_VERSION >= 0x0500)
  1238. // For back-compatibility with legacy compilations
  1239. #define D3DRENDERSTATE_BLENDENABLE      D3DRENDERSTATE_ALPHABLENDENABLE
  1240. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1241.  
  1242. #if(DIRECT3D_VERSION >= 0x0600)
  1243.  
  1244. // Bias to apply to the texture coordinate set to apply a wrap to.
  1245. #define D3DRENDERSTATE_WRAPBIAS                 128UL
  1246.  
  1247. /* Flags to construct the WRAP render states */
  1248. #define D3DWRAP_U   0x00000001L
  1249. #define D3DWRAP_V   0x00000002L
  1250.  
  1251. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1252.  
  1253. #if(DIRECT3D_VERSION >= 0x0700)
  1254.  
  1255. /* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */
  1256. #define D3DWRAPCOORD_0   0x00000001L    // same as D3DWRAP_U
  1257. #define D3DWRAPCOORD_1   0x00000002L    // same as D3DWRAP_V
  1258. #define D3DWRAPCOORD_2   0x00000004L
  1259. #define D3DWRAPCOORD_3   0x00000008L
  1260.  
  1261. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1262.  
  1263. #define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y))
  1264.  
  1265. typedef struct _D3DSTATE {
  1266.     union {
  1267.     D3DTRANSFORMSTATETYPE   dtstTransformStateType;
  1268.     D3DLIGHTSTATETYPE   dlstLightStateType;
  1269.     D3DRENDERSTATETYPE  drstRenderStateType;
  1270.     };
  1271.     union {
  1272.     DWORD           dwArg[1];
  1273.     D3DVALUE        dvArg[1];
  1274.     };
  1275. } D3DSTATE, *LPD3DSTATE;
  1276.  
  1277. /*
  1278.  * Operation used to load matrices
  1279.  * hDstMat = hSrcMat
  1280.  */
  1281. typedef struct _D3DMATRIXLOAD {
  1282.     D3DMATRIXHANDLE hDestMatrix;   /* Destination matrix */
  1283.     D3DMATRIXHANDLE hSrcMatrix;   /* Source matrix */
  1284. } D3DMATRIXLOAD, *LPD3DMATRIXLOAD;
  1285.  
  1286. /*
  1287.  * Operation used to multiply matrices
  1288.  * hDstMat = hSrcMat1 * hSrcMat2
  1289.  */
  1290. typedef struct _D3DMATRIXMULTIPLY {
  1291.     D3DMATRIXHANDLE hDestMatrix;   /* Destination matrix */
  1292.     D3DMATRIXHANDLE hSrcMatrix1;  /* First source matrix */
  1293.     D3DMATRIXHANDLE hSrcMatrix2;  /* Second source matrix */
  1294. } D3DMATRIXMULTIPLY, *LPD3DMATRIXMULTIPLY;
  1295.  
  1296. /*
  1297.  * Operation used to transform and light vertices.
  1298.  */
  1299. typedef struct _D3DPROCESSVERTICES {
  1300.     DWORD        dwFlags;    /* Do we transform or light or just copy? */
  1301.     WORD         wStart;     /* Index to first vertex in source */
  1302.     WORD         wDest;      /* Index to first vertex in local buffer */
  1303.     DWORD        dwCount;    /* Number of vertices to be processed */
  1304.     DWORD    dwReserved; /* Must be zero */
  1305. } D3DPROCESSVERTICES, *LPD3DPROCESSVERTICES;
  1306.  
  1307. #define D3DPROCESSVERTICES_TRANSFORMLIGHT   0x00000000L
  1308. #define D3DPROCESSVERTICES_TRANSFORM        0x00000001L
  1309. #define D3DPROCESSVERTICES_COPY         0x00000002L
  1310. #define D3DPROCESSVERTICES_OPMASK       0x00000007L
  1311.  
  1312. #define D3DPROCESSVERTICES_UPDATEEXTENTS    0x00000008L
  1313. #define D3DPROCESSVERTICES_NOCOLOR      0x00000010L
  1314.  
  1315.  
  1316. #if(DIRECT3D_VERSION >= 0x0600)
  1317.  
  1318.  
  1319. /*
  1320.  * State enumerants for per-stage texture processing.
  1321.  */
  1322. typedef enum _D3DTEXTURESTAGESTATETYPE
  1323. {
  1324.     D3DTSS_COLOROP        =  1, /* D3DTEXTUREOP - per-stage blending controls for color channels */
  1325.     D3DTSS_COLORARG1      =  2, /* D3DTA_* (texture arg) */
  1326.     D3DTSS_COLORARG2      =  3, /* D3DTA_* (texture arg) */
  1327.     D3DTSS_ALPHAOP        =  4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */
  1328.     D3DTSS_ALPHAARG1      =  5, /* D3DTA_* (texture arg) */
  1329.     D3DTSS_ALPHAARG2      =  6, /* D3DTA_* (texture arg) */
  1330.     D3DTSS_BUMPENVMAT00   =  7, /* D3DVALUE (bump mapping matrix) */
  1331.     D3DTSS_BUMPENVMAT01   =  8, /* D3DVALUE (bump mapping matrix) */
  1332.     D3DTSS_BUMPENVMAT10   =  9, /* D3DVALUE (bump mapping matrix) */
  1333.     D3DTSS_BUMPENVMAT11   = 10, /* D3DVALUE (bump mapping matrix) */
  1334.     D3DTSS_TEXCOORDINDEX  = 11, /* identifies which set of texture coordinates index this texture */
  1335.     D3DTSS_ADDRESS        = 12, /* D3DTEXTUREADDRESS for both coordinates */
  1336.     D3DTSS_ADDRESSU       = 13, /* D3DTEXTUREADDRESS for U coordinate */
  1337.     D3DTSS_ADDRESSV       = 14, /* D3DTEXTUREADDRESS for V coordinate */
  1338.     D3DTSS_BORDERCOLOR    = 15, /* D3DCOLOR */
  1339.     D3DTSS_MAGFILTER      = 16, /* D3DTEXTUREMAGFILTER filter to use for magnification */
  1340.     D3DTSS_MINFILTER      = 17, /* D3DTEXTUREMINFILTER filter to use for minification */
  1341.     D3DTSS_MIPFILTER      = 18, /* D3DTEXTUREMIPFILTER filter to use between mipmaps during minification */
  1342.     D3DTSS_MIPMAPLODBIAS  = 19, /* D3DVALUE Mipmap LOD bias */
  1343.     D3DTSS_MAXMIPLEVEL    = 20, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */
  1344.     D3DTSS_MAXANISOTROPY  = 21, /* DWORD maximum anisotropy */
  1345.     D3DTSS_BUMPENVLSCALE  = 22, /* D3DVALUE scale for bump map luminance */
  1346.     D3DTSS_BUMPENVLOFFSET = 23, /* D3DVALUE offset for bump map luminance */
  1347. #if(DIRECT3D_VERSION >= 0x0700)
  1348.     D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */
  1349. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1350.     D3DTSS_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
  1351. } D3DTEXTURESTAGESTATETYPE;
  1352.  
  1353. #if(DIRECT3D_VERSION >= 0x0700)
  1354. // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
  1355. // and normal in the camera space) should be taken as texture coordinates
  1356. // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
  1357. //
  1358. #define D3DTSS_TCI_PASSTHRU                             0x00000000
  1359. #define D3DTSS_TCI_CAMERASPACENORMAL                    0x00010000
  1360. #define D3DTSS_TCI_CAMERASPACEPOSITION                  0x00020000
  1361. #define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR          0x00030000
  1362. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1363.  
  1364. /*
  1365.  * Enumerations for COLOROP and ALPHAOP texture blending operations set in
  1366.  * texture processing stage controls in D3DRENDERSTATE.
  1367.  */
  1368. typedef enum _D3DTEXTUREOP
  1369. {
  1370. // Control
  1371.     D3DTOP_DISABLE    = 1,      // disables stage
  1372.     D3DTOP_SELECTARG1 = 2,      // the default
  1373.     D3DTOP_SELECTARG2 = 3,
  1374.  
  1375. // Modulate
  1376.     D3DTOP_MODULATE   = 4,      // multiply args together
  1377.     D3DTOP_MODULATE2X = 5,      // multiply and  1 bit
  1378.     D3DTOP_MODULATE4X = 6,      // multiply and  2 bits
  1379.  
  1380. // Add
  1381.     D3DTOP_ADD          =  7,   // add arguments together
  1382.     D3DTOP_ADDSIGNED    =  8,   // add with -0.5 bias
  1383.     D3DTOP_ADDSIGNED2X  =  9,   // as above but left  1 bit
  1384.     D3DTOP_SUBTRACT     = 10,   // Arg1 - Arg2, with no saturation
  1385.     D3DTOP_ADDSMOOTH    = 11,   // add 2 args, subtract product
  1386.                                 // Arg1 + Arg2 - Arg1*Arg2
  1387.                                 // = Arg1 + (1-Arg1)*Arg2
  1388.  
  1389. // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
  1390.     D3DTOP_BLENDDIFFUSEALPHA    = 12, // iterated alpha
  1391.     D3DTOP_BLENDTEXTUREALPHA    = 13, // texture alpha
  1392.     D3DTOP_BLENDFACTORALPHA     = 14, // alpha from D3DRENDERSTATE_TEXTUREFACTOR
  1393.     // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
  1394.     D3DTOP_BLENDTEXTUREALPHAPM  = 15, // texture alpha
  1395.     D3DTOP_BLENDCURRENTALPHA    = 16, // by alpha of current color
  1396.  
  1397. // Specular mapping
  1398.     D3DTOP_PREMODULATE            = 17,     // modulate with next texture before use
  1399.     D3DTOP_MODULATEALPHA_ADDCOLOR = 18,     // Arg1.RGB + Arg1.A*Arg2.RGB
  1400.                                             // COLOROP only
  1401.     D3DTOP_MODULATECOLOR_ADDALPHA = 19,     // Arg1.RGB*Arg2.RGB + Arg1.A
  1402.                                             // COLOROP only
  1403.     D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,  // (1-Arg1.A)*Arg2.RGB + Arg1.RGB
  1404.                                             // COLOROP only
  1405.     D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,  // (1-Arg1.RGB)*Arg2.RGB + Arg1.A
  1406.                                             // COLOROP only
  1407.  
  1408. // Bump mapping
  1409.     D3DTOP_BUMPENVMAP           = 22, // per pixel env map perturbation
  1410.     D3DTOP_BUMPENVMAPLUMINANCE  = 23, // with luminance channel
  1411.     // This can do either diffuse or specular bump mapping with correct input.
  1412.     // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
  1413.     // where each component has been scaled and offset to make it signed.
  1414.     // The result is replicated into all four (including alpha) channels.
  1415.     // This is a valid COLOROP only.
  1416.     D3DTOP_DOTPRODUCT3          = 24,
  1417.  
  1418.     D3DTOP_FORCE_DWORD = 0x7fffffff,
  1419. } D3DTEXTUREOP;
  1420.  
  1421. /*
  1422.  * Values for COLORARG1,2 and ALPHAARG1,2 texture blending operations
  1423.  * set in texture processing stage controls in D3DRENDERSTATE.
  1424.  */
  1425. #define D3DTA_SELECTMASK        0x0000000f  // mask for arg selector
  1426. #define D3DTA_DIFFUSE           0x00000000  // select diffuse color
  1427. #define D3DTA_CURRENT           0x00000001  // select result of previous stage
  1428. #define D3DTA_TEXTURE           0x00000002  // select texture color
  1429. #define D3DTA_TFACTOR           0x00000003  // select RENDERSTATE_TEXTUREFACTOR
  1430. #if(DIRECT3D_VERSION >= 0x0700)
  1431. #define D3DTA_SPECULAR          0x00000004  // select specular color
  1432. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1433. #define D3DTA_COMPLEMENT        0x00000010  // take 1.0 - x
  1434. #define D3DTA_ALPHAREPLICATE    0x00000020  // replicate alpha to color components
  1435.  
  1436.  
  1437. /*
  1438.  *  IDirect3DTexture2 State Filter Types
  1439.  */
  1440. typedef enum _D3DTEXTUREMAGFILTER
  1441. {
  1442.     D3DTFG_POINT        = 1,    // nearest
  1443.     D3DTFG_LINEAR       = 2,    // linear interpolation
  1444.     D3DTFG_FLATCUBIC    = 3,    // cubic
  1445.     D3DTFG_GAUSSIANCUBIC = 4,   // different cubic kernel
  1446.     D3DTFG_ANISOTROPIC  = 5,    //
  1447. #if(DIRECT3D_VERSION >= 0x0700)
  1448. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1449.     D3DTFG_FORCE_DWORD  = 0x7fffffff,   // force 32-bit size enum
  1450. } D3DTEXTUREMAGFILTER;
  1451.  
  1452. typedef enum _D3DTEXTUREMINFILTER
  1453. {
  1454.     D3DTFN_POINT        = 1,    // nearest
  1455.     D3DTFN_LINEAR       = 2,    // linear interpolation
  1456.     D3DTFN_ANISOTROPIC  = 3,    //
  1457.     D3DTFN_FORCE_DWORD  = 0x7fffffff,   // force 32-bit size enum
  1458. } D3DTEXTUREMINFILTER;
  1459.  
  1460. typedef enum _D3DTEXTUREMIPFILTER
  1461. {
  1462.     D3DTFP_NONE         = 1,    // mipmapping disabled (use MAG filter)
  1463.     D3DTFP_POINT        = 2,    // nearest
  1464.     D3DTFP_LINEAR       = 3,    // linear interpolation
  1465.     D3DTFP_FORCE_DWORD  = 0x7fffffff,   // force 32-bit size enum
  1466. } D3DTEXTUREMIPFILTER;
  1467.  
  1468. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1469.  
  1470. /*
  1471.  * Triangle flags
  1472.  */
  1473.  
  1474. /*
  1475.  * Tri strip and fan flags.
  1476.  * START loads all three vertices
  1477.  * EVEN and ODD load just v3 with even or odd culling
  1478.  * START_FLAT contains a count from 0 to 29 that allows the
  1479.  * whole strip or fan to be culled in one hit.
  1480.  * e.g. for a quad len = 1
  1481.  */
  1482. #define D3DTRIFLAG_START            0x00000000L
  1483. #define D3DTRIFLAG_STARTFLAT(len) (len)     /* 0 < len < 30 */
  1484. #define D3DTRIFLAG_ODD              0x0000001eL
  1485. #define D3DTRIFLAG_EVEN             0x0000001fL
  1486.  
  1487. /*
  1488.  * Triangle edge flags
  1489.  * enable edges for wireframe or antialiasing
  1490.  */
  1491. #define D3DTRIFLAG_EDGEENABLE1          0x00000100L /* v0-v1 edge */
  1492. #define D3DTRIFLAG_EDGEENABLE2          0x00000200L /* v1-v2 edge */
  1493. #define D3DTRIFLAG_EDGEENABLE3          0x00000400L /* v2-v0 edge */
  1494. #define D3DTRIFLAG_EDGEENABLETRIANGLE \
  1495.         (D3DTRIFLAG_EDGEENABLE1 | D3DTRIFLAG_EDGEENABLE2 | D3DTRIFLAG_EDGEENABLE3)
  1496.  
  1497. /*
  1498.  * Primitive structures and related defines.  Vertex offsets are to types
  1499.  * D3DVERTEX, D3DLVERTEX, or D3DTLVERTEX.
  1500.  */
  1501.  
  1502. /*
  1503.  * Triangle list primitive structure
  1504.  */
  1505. typedef struct _D3DTRIANGLE {
  1506.     union {
  1507.     WORD    v1;            /* Vertex indices */
  1508.     WORD    wV1;
  1509.     };
  1510.     union {
  1511.     WORD    v2;
  1512.     WORD    wV2;
  1513.     };
  1514.     union {
  1515.     WORD    v3;
  1516.     WORD    wV3;
  1517.     };
  1518.     WORD        wFlags;       /* Edge (and other) flags */
  1519. } D3DTRIANGLE, *LPD3DTRIANGLE;
  1520.  
  1521. /*
  1522.  * Line list structure.
  1523.  * The instruction count defines the number of line segments.
  1524.  */
  1525. typedef struct _D3DLINE {
  1526.     union {
  1527.     WORD    v1;            /* Vertex indices */
  1528.     WORD    wV1;
  1529.     };
  1530.     union {
  1531.     WORD    v2;
  1532.     WORD    wV2;
  1533.     };
  1534. } D3DLINE, *LPD3DLINE;
  1535.  
  1536. /*
  1537.  * Span structure
  1538.  * Spans join a list of points with the same y value.
  1539.  * If the y value changes, a new span is started.
  1540.  */
  1541. typedef struct _D3DSPAN {
  1542.     WORD    wCount; /* Number of spans */
  1543.     WORD    wFirst; /* Index to first vertex */
  1544. } D3DSPAN, *LPD3DSPAN;
  1545.  
  1546. /*
  1547.  * Point structure
  1548.  */
  1549. typedef struct _D3DPOINT {
  1550.     WORD    wCount;     /* number of points     */
  1551.     WORD    wFirst;     /* index to first vertex    */
  1552. } D3DPOINT, *LPD3DPOINT;
  1553.  
  1554.  
  1555. /*
  1556.  * Forward branch structure.
  1557.  * Mask is logically anded with the driver status mask
  1558.  * if the result equals 'value', the branch is taken.
  1559.  */
  1560. typedef struct _D3DBRANCH {
  1561.     DWORD   dwMask;     /* Bitmask against D3D status */
  1562.     DWORD   dwValue;
  1563.     BOOL    bNegate;        /* TRUE to negate comparison */
  1564.     DWORD   dwOffset;   /* How far to branch forward (0 for exit)*/
  1565. } D3DBRANCH, *LPD3DBRANCH;
  1566.  
  1567. /*
  1568.  * Status used for set status instruction.
  1569.  * The D3D status is initialised on device creation
  1570.  * and is modified by all execute calls.
  1571.  */
  1572. typedef struct _D3DSTATUS {
  1573.     DWORD       dwFlags;    /* Do we set extents or status */
  1574.     DWORD   dwStatus;   /* D3D status */
  1575.     D3DRECT drExtent;
  1576. } D3DSTATUS, *LPD3DSTATUS;
  1577.  
  1578. #define D3DSETSTATUS_STATUS     0x00000001L
  1579. #define D3DSETSTATUS_EXTENTS        0x00000002L
  1580. #define D3DSETSTATUS_ALL    (D3DSETSTATUS_STATUS | D3DSETSTATUS_EXTENTS)
  1581.  
  1582. #if(DIRECT3D_VERSION >= 0x0500)
  1583. typedef struct _D3DCLIPSTATUS {
  1584.     DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */
  1585.     DWORD dwStatus; /* Clip status */
  1586.     float minx, maxx; /* X extents */
  1587.     float miny, maxy; /* Y extents */
  1588.     float minz, maxz; /* Z extents */
  1589. } D3DCLIPSTATUS, *LPD3DCLIPSTATUS;
  1590.  
  1591. #define D3DCLIPSTATUS_STATUS        0x00000001L
  1592. #define D3DCLIPSTATUS_EXTENTS2      0x00000002L
  1593. #define D3DCLIPSTATUS_EXTENTS3      0x00000004L
  1594.  
  1595. #endif /* DIRECT3D_VERSION >= 0x0500 */
  1596. /*
  1597.  * Statistics structure
  1598.  */
  1599. typedef struct _D3DSTATS {
  1600.     DWORD        dwSize;
  1601.     DWORD        dwTrianglesDrawn;
  1602.     DWORD        dwLinesDrawn;
  1603.     DWORD        dwPointsDrawn;
  1604.     DWORD        dwSpansDrawn;
  1605.     DWORD        dwVerticesProcessed;
  1606. } D3DSTATS, *LPD3DSTATS;
  1607.  
  1608. /*
  1609.  * Execute options.
  1610.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  1611.  * inside the buffer must be contained within the viewport.
  1612.  */
  1613. #define D3DEXECUTE_CLIPPED       0x00000001l
  1614. #define D3DEXECUTE_UNCLIPPED     0x00000002l
  1615.  
  1616. typedef struct _D3DEXECUTEDATA {
  1617.     DWORD       dwSize;
  1618.     DWORD       dwVertexOffset;
  1619.     DWORD       dwVertexCount;
  1620.     DWORD       dwInstructionOffset;
  1621.     DWORD       dwInstructionLength;
  1622.     DWORD       dwHVertexOffset;
  1623.     D3DSTATUS   dsStatus;   /* Status after execute */
  1624. } D3DEXECUTEDATA, *LPD3DEXECUTEDATA;
  1625.  
  1626. /*
  1627.  * Palette flags.
  1628.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  1629.  */
  1630. #define D3DPAL_FREE 0x00    /* Renderer may use this entry freely */
  1631. #define D3DPAL_READONLY 0x40    /* Renderer may not set this entry */
  1632. #define D3DPAL_RESERVED 0x80    /* Renderer may not use this entry */
  1633.  
  1634.  
  1635. #if(DIRECT3D_VERSION >= 0x0600)
  1636.  
  1637. typedef struct _D3DVERTEXBUFFERDESC {
  1638.     DWORD dwSize;
  1639.     DWORD dwCaps;
  1640.     DWORD dwFVF;
  1641.     DWORD dwNumVertices;
  1642. } D3DVERTEXBUFFERDESC, *LPD3DVERTEXBUFFERDESC;
  1643.  
  1644. #define D3DVBCAPS_SYSTEMMEMORY      0x00000800l
  1645. #define D3DVBCAPS_WRITEONLY         0x00010000l
  1646. #define D3DVBCAPS_OPTIMIZED         0x80000000l
  1647. #define D3DVBCAPS_DONOTCLIP         0x00000001l
  1648.  
  1649. /* Vertex Operations for ProcessVertices */
  1650. #define D3DVOP_LIGHT       (1 << 10)
  1651. #define D3DVOP_TRANSFORM   (1 << 0)
  1652. #define D3DVOP_CLIP        (1 << 2)
  1653. #define D3DVOP_EXTENTS     (1 << 3)
  1654.  
  1655. /* The maximum number of vertices user can pass to any d3d
  1656.    drawing function or to create vertex buffer with
  1657. */
  1658. #define D3DMAXNUMVERTICES    ((1<<16) - 1)
  1659. /* The maximum number of primitives user can pass to any d3d
  1660.    drawing function.
  1661. */
  1662. #define D3DMAXNUMPRIMITIVES  ((1<<16) - 1)
  1663.  
  1664. #if(DIRECT3D_VERSION >= 0x0700)
  1665.  
  1666. /* Bits for dwFlags in ProcessVertices call */
  1667. #define D3DPV_DONOTCOPYDATA (1 << 0)
  1668.  
  1669. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1670. //-------------------------------------------------------------------
  1671.  
  1672. // Flexible vertex format bits
  1673. //
  1674. #define D3DFVF_RESERVED0        0x001
  1675. #define D3DFVF_POSITION_MASK    0x00E
  1676. #define D3DFVF_XYZ              0x002
  1677. #define D3DFVF_XYZRHW           0x004
  1678. #if(DIRECT3D_VERSION >= 0x0700)
  1679. #define D3DFVF_XYZB1            0x006
  1680. #define D3DFVF_XYZB2            0x008
  1681. #define D3DFVF_XYZB3            0x00a
  1682. #define D3DFVF_XYZB4            0x00c
  1683. #define D3DFVF_XYZB5            0x00e
  1684.  
  1685. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1686. #define D3DFVF_NORMAL           0x010
  1687. #define D3DFVF_RESERVED1        0x020
  1688. #define D3DFVF_DIFFUSE          0x040
  1689. #define D3DFVF_SPECULAR         0x080
  1690.  
  1691. #define D3DFVF_TEXCOUNT_MASK    0xf00
  1692. #define D3DFVF_TEXCOUNT_SHIFT   8
  1693. #define D3DFVF_TEX0             0x000
  1694. #define D3DFVF_TEX1             0x100
  1695. #define D3DFVF_TEX2             0x200
  1696. #define D3DFVF_TEX3             0x300
  1697. #define D3DFVF_TEX4             0x400
  1698. #define D3DFVF_TEX5             0x500
  1699. #define D3DFVF_TEX6             0x600
  1700. #define D3DFVF_TEX7             0x700
  1701. #define D3DFVF_TEX8             0x800
  1702.  
  1703. #define D3DFVF_RESERVED2        0xf000  // 4 reserved bits
  1704.  
  1705. #define D3DFVF_VERTEX ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
  1706. #define D3DFVF_LVERTEX ( D3DFVF_XYZ | D3DFVF_RESERVED1 | D3DFVF_DIFFUSE | \
  1707.                          D3DFVF_SPECULAR | D3DFVF_TEX1 )
  1708. #define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \
  1709.                           D3DFVF_TEX1 )
  1710.  
  1711. typedef struct _D3DDP_PTRSTRIDE
  1712. {
  1713.     LPVOID lpvData;
  1714.     DWORD  dwStride;
  1715. } D3DDP_PTRSTRIDE;
  1716.  
  1717. #define D3DDP_MAXTEXCOORD 8
  1718.  
  1719. typedef struct _D3DDRAWPRIMITIVESTRIDEDDATA
  1720. {
  1721.     D3DDP_PTRSTRIDE position;
  1722.     D3DDP_PTRSTRIDE normal;
  1723.     D3DDP_PTRSTRIDE diffuse;
  1724.     D3DDP_PTRSTRIDE specular;
  1725.     D3DDP_PTRSTRIDE textureCoords[D3DDP_MAXTEXCOORD];
  1726. } D3DDRAWPRIMITIVESTRIDEDDATA, *LPD3DDRAWPRIMITIVESTRIDEDDATA;
  1727. //---------------------------------------------------------------------
  1728. // ComputeSphereVisibility return values
  1729. //
  1730. #define D3DVIS_INSIDE_FRUSTUM       0
  1731. #define D3DVIS_INTERSECT_FRUSTUM    1
  1732. #define D3DVIS_OUTSIDE_FRUSTUM      2
  1733. #define D3DVIS_INSIDE_LEFT          0
  1734. #define D3DVIS_INTERSECT_LEFT       (1 << 2)
  1735. #define D3DVIS_OUTSIDE_LEFT         (2 << 2)
  1736. #define D3DVIS_INSIDE_RIGHT         0
  1737. #define D3DVIS_INTERSECT_RIGHT      (1 << 4)
  1738. #define D3DVIS_OUTSIDE_RIGHT        (2 << 4)
  1739. #define D3DVIS_INSIDE_TOP           0
  1740. #define D3DVIS_INTERSECT_TOP        (1 << 6)
  1741. #define D3DVIS_OUTSIDE_TOP          (2 << 6)
  1742. #define D3DVIS_INSIDE_BOTTOM        0
  1743. #define D3DVIS_INTERSECT_BOTTOM     (1 << 8)
  1744. #define D3DVIS_OUTSIDE_BOTTOM       (2 << 8)
  1745. #define D3DVIS_INSIDE_NEAR          0
  1746. #define D3DVIS_INTERSECT_NEAR       (1 << 10)
  1747. #define D3DVIS_OUTSIDE_NEAR         (2 << 10)
  1748. #define D3DVIS_INSIDE_FAR           0
  1749. #define D3DVIS_INTERSECT_FAR        (1 << 12)
  1750. #define D3DVIS_OUTSIDE_FAR          (2 << 12)
  1751.  
  1752. #define D3DVIS_MASK_FRUSTUM         (3 << 0)
  1753. #define D3DVIS_MASK_LEFT            (3 << 2)
  1754. #define D3DVIS_MASK_RIGHT           (3 << 4)
  1755. #define D3DVIS_MASK_TOP             (3 << 6)
  1756. #define D3DVIS_MASK_BOTTOM          (3 << 8)
  1757. #define D3DVIS_MASK_NEAR            (3 << 10)
  1758. #define D3DVIS_MASK_FAR             (3 << 12)
  1759.  
  1760. #endif /* DIRECT3D_VERSION >= 0x0600 */
  1761.  
  1762. #if(DIRECT3D_VERSION >= 0x0700)
  1763.  
  1764. // To be used with GetInfo()
  1765. #define D3DDEVINFOID_TEXTUREMANAGER    1
  1766. #define D3DDEVINFOID_D3DTEXTUREMANAGER 2
  1767. #define D3DDEVINFOID_TEXTURING         3
  1768.  
  1769. typedef enum _D3DSTATEBLOCKTYPE
  1770. {
  1771.     D3DSBT_ALL           = 1, // capture all state
  1772.     D3DSBT_PIXELSTATE    = 2, // capture pixel state
  1773.     D3DSBT_VERTEXSTATE   = 3, // capture vertex state
  1774.     D3DSBT_FORCE_DWORD   = 0xffffffff
  1775. } D3DSTATEBLOCKTYPE;
  1776.  
  1777. // The D3DVERTEXBLENDFLAGS type is used with D3DRENDERSTATE_VERTEXBLEND state.
  1778. //
  1779. typedef enum _D3DVERTEXBLENDFLAGS
  1780. {
  1781.     D3DVBLEND_DISABLE  = 0, // Disable vertex blending
  1782.     D3DVBLEND_1WEIGHT  = 1, // blend between 2 matrices
  1783.     D3DVBLEND_2WEIGHTS = 2, // blend between 3 matrices
  1784.     D3DVBLEND_3WEIGHTS = 3, // blend between 4 matrices
  1785. } D3DVERTEXBLENDFLAGS;
  1786.  
  1787. typedef enum _D3DTEXTURETRANSFORMFLAGS {
  1788.     D3DTTFF_DISABLE         = 0,    // texture coordinates are passed directly
  1789.     D3DTTFF_COUNT1          = 1,    // rasterizer should expect 1-D texture coords
  1790.     D3DTTFF_COUNT2          = 2,    // rasterizer should expect 2-D texture coords
  1791.     D3DTTFF_COUNT3          = 3,    // rasterizer should expect 3-D texture coords
  1792.     D3DTTFF_COUNT4          = 4,    // rasterizer should expect 4-D texture coords
  1793.     D3DTTFF_PROJECTED       = 256,  // texcoords to be divided by COUNTth element
  1794.     D3DTTFF_FORCE_DWORD     = 0x7fffffff,
  1795. } D3DTEXTURETRANSFORMFLAGS;
  1796.  
  1797. // Macros to set texture coordinate format bits in the FVF id
  1798.  
  1799. #define D3DFVF_TEXTUREFORMAT2 0         // Two floating point values
  1800. #define D3DFVF_TEXTUREFORMAT1 3         // One floating point value
  1801. #define D3DFVF_TEXTUREFORMAT3 1         // Three floating point values
  1802. #define D3DFVF_TEXTUREFORMAT4 2         // Four floating point values
  1803.  
  1804. #define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
  1805. #define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
  1806. #define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
  1807. #define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
  1808.  
  1809.  
  1810. #endif /* DIRECT3D_VERSION >= 0x0700 */
  1811.  
  1812. #pragma pack()
  1813. #pragma warning(default:4201)
  1814.  
  1815. #endif /* _D3DTYPES_H_ */
  1816.  
  1817.